package com.xiaobaibai.common;

import com.xiaobaibai.units.pay.KeyPairFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.*;
import java.security.KeyPair;

@Component
public class PayCommon {

    public static String mchid;

    public static String notifyUrl;//回调地址

    public static String serialNumber; //证书号

    public static String keyPath;

    public static String keyPass;

    public final static String keyAlias="Tenpay Certificate";

    public static String apiV3Key;

    public static String adminPhone;

    @Value("${PAY.mchid}")
    public void setMchid(String mchid) {
        PayCommon.mchid = mchid;
    }

    @Value("${PAY.notifyUrl}")
    public void setNotifyUrl(String notifyUrl) {
        PayCommon.notifyUrl = notifyUrl;
    }

    @Value("${PAY.serialNumber}")
    public void setSerialNumber(String serialNumber) {
        PayCommon.serialNumber = serialNumber;
    }

    @Value("${PAY.keyPath}")
    public void setKeyPath(String keyPath) {
        PayCommon.keyPath = keyPath;
    }

    @Value("${PAY.keyPass}")
    public void setKeyPass(String keyPass) {
        PayCommon.keyPass = keyPass;
    }

    @Value("${PAY.apiV3Key}")
    public void setApiV3Key(String apiV3Key) {
        PayCommon.apiV3Key = apiV3Key;
    }

    @Value("${PAY.adminPhone}")
    public void setAdminPhone(String adminPhone) {
        PayCommon.adminPhone = adminPhone;
    }

}
